import request from '@/utils/request'

export function getMenus(data) {
  return request({
    url: '/auth/RoleMenu',
    method: 'get',
    params: {
      role: data
    }
  })
}

export function getMenusData(data) {
  return request({
    url: '/auth/RoleMenuData',
    method: 'get',
    params: {
      role: data
    }
  })
}

export function getAllMenus(data) {
  return request({
    url: '/auth/RoleMenus',
    method: 'get',
    params: {
      role: data
    }
  })
}

export function updateRoleMenu(data) {
  return request({
    url: `/auth/AssignMenuData`,
    method: 'PUT',
    data
  })
}

export function fetchList(query) {
  return request({
    url: '/role',
    method: 'GET',
    params: query
  })
}

export function getRole(id) {
  return request({
    url: `/role/${id}`,
    method: 'GET'
  })
}

export function saveRole(data) {
  return request({
    url: '/role',
    method: 'POST',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: `/role/${id}`,
    method: 'DELETE'
  })
}

export function updateRole(data) {
  return request({
    url: `/role/${data.Id}`,
    method: 'PUT',
    data
  })
}
